const path = require('path')
const fs = require('fs')

const env = process.env.NODE_ENV || 'development'
fs.writeFileSync(path.join(__dirname, './config/env.js'), `export default '${env}'`)

const BASE_URL = '/'

module.exports = {
    publicPath: BASE_URL,
    pages: {
        index: {
            entry: 'src/main.js',
            template: 'public/index.html',
            filename: 'index.html'
        }
    },
    assetsDir: 'static',
    configureWebpack: {
        module: {
            rules: [
                {
                    test: /\.md$/,
                    use: ['text-loader']
                }
            ]
        },
        plugins: []
    },
    // webpack-dev-server 相关配置
    devServer: {
        port: 8090,
    }
}
